﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace PefStudio.Services
{
    public class TextWriterMessageService : IMessageService
    {
        public TextWriter Writer { get; set; }

        public TextWriterMessageService()
        {
            Writer = Console.Out;
        }

        public void ShowError(string message)
        {
            Writer.WriteLine(message);
        }

        public void ShowException(Exception ex, string message)
        {
            if (message != null)
            {
                Writer.WriteLine(message);
            }
            if (ex != null)
            {
                Writer.WriteLine(ex.ToString());
            }
        }

        public void ShowWarning(string message)
        {
            Writer.WriteLine(message);
        }

        public void ShowMessage(string message, string caption)
        {
            Writer.WriteLine(caption + ": " + message);
        }
    }
}
